package com.ruoyi.project.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * 项目划分分类
 * @TableName project_category
 */
@TableName("project_category")
@ApiModel("项目分类实体")
@Data
public class ProjectCategory implements Serializable {
    private static final long serialVersionUID = 1L;

    @TableId(type = IdType.AUTO)
    @ApiModelProperty(value = "主键ID", example = "1")
    private Long id;

    @TableField("parent_id")
    @ApiModelProperty(value = "父级ID", example = "0")
    private Long parentId;

    @TableField("project_id")
    @ApiModelProperty(value = "项目ID", required = true, example = "1001")
    private Long projectId;

    @TableField("name")
    @ApiModelProperty(value = "分类名称", example = "土建工程")
    private String name;

    @TableField("project_category_code")
    @Size(max = 20, message = "项目编号长度不能超过20个字符")
    @ApiModelProperty(value = "项目编号", example = "TJ-001", required = true)
    private String projectCategoryCode;

    @TableField("remark")
    @Size(max = 200, message = "备注长度不能超过200个字符")
    @ApiModelProperty(value = "备注", example = "重要优先级项目", required = true)
    private String remark;

    @TableField("level")
    @Min(value = 0, message = "层级最小值为0")
    @Max(value = 3, message = "层级最大值为3")
    @ApiModelProperty(value = "层级（0:整个工程 1:单位工程 2:分部工程 3:单元工程）", example = "1", required = true)
    private Integer level;

    @TableField("level_name")
    @ApiModelProperty(value = "层级名称", required = true, example = "单位工程")
    @NotBlank(message = "层级名称不能为空")
    private String levelName;

    @TableField("status")
    @ApiModelProperty(value = "状态（0:不锁定 1:锁定）", example = "0")
    private Integer status;

    @TableField("color_status")
    @ApiModelProperty(value = "颜色状态（0:无色 1:红色 2:黄色 3:蓝色 4:绿色）", example = "1")
    private Integer colorStatus;

    @TableField("project_template_id")
    @ApiModelProperty(value = "绑定的项目模板ID", example = "10")
    private Long projectTemplateId;

    @TableField("project_template_status")
    @ApiModelProperty(value = "模板生成状态（0:未生成 1:已生成）", example = "0")
    private Integer projectTemplateStatus;

    @TableField("sort")
    @ApiModelProperty(value = "排序字段）", example = "0")
    private Integer sort;

    @TableField("user_id")
    @ApiModelProperty(value = "创建人ID", example = "10001")
    private Long userId;

    @TableField("dept_id")
    @ApiModelProperty(value = "部门ID", example = "101")
    private Long deptId;

    @TableField("create_by")
    @ApiModelProperty(value = "创建人姓名", example = "张三")
    private String createBy;

    @TableField("create_time")
    @ApiModelProperty(value = "创建时间", example = "2023-01-01 12:00:00")
    private Date createTime;

    @TableField("update_by")
    @ApiModelProperty(value = "更新人姓名", example = "李四")
    private String updateBy;

    @TableField("update_time")
    @ApiModelProperty(value = "更新时间", example = "2023-01-02 13:00:00")
    private Date updateTime;

    @TableField(exist = false)
    @ApiModelProperty("子分类列表")
    private List<ProjectCategory> children;

    @ApiModelProperty(value = "是否删除标识 true 删除", example = "false")
    @TableField(exist = false)
    private Boolean deleteFlag=false;

    @ApiModelProperty(value = "排序号名字展示用", example = "1.1.2")
    @TableField(exist = false)
    private String sortName;
}